# Maintainer: Hoang Nguyen <folliekazetani@protonmail.com>
pkgname=vals
pkgver=0.32.0
pkgrel=0
pkgdesc="Helm-like configuration values loader with support for various sources"
url="https://github.com/helmfile/vals"
arch="all"
license="Apache-2.0"
makedepends="go"
source="$pkgname-$pkgver.tar.gz::https://github.com/helmfile/vals/archive/refs/tags/v$pkgver.tar.gz"

export GOCACHE="${GOCACHE:-"$srcdir/go-cache"}"
export GOTMPDIR="${GOTMPDIR:-"$srcdir"}"
export GOMODCACHE="${GOMODCACHE:-"$srcdir/go"}"

build() {
	go build -v \
		-o bin/$pkgname \
		-ldflags "-X main.version=v$pkgver -X main.commit=AlpineLinux" \
		./cmd/vals
}

check() {
	# TestValues_.* tests require the running backend services
	# TestGetStringMap test fails in CI only (XXX: investigate more)
	# Tests in pkg/providers/k8s module requires a kubeconfig file with a locally running k8s cluster
	# shellcheck disable=2046
	go test -skip 'TestValues_.*|TestGetStringMap' $(go list ./... | grep -v 'pkg/providers/k8s')
}

package() {
	install -Dm755 bin/$pkgname -t "$pkgdir"/usr/bin/
}

sha512sums="
cdfb621b4fa756895f798808eb8ce160d8724b26a2289b80a30271b991c72c8e621d89c2dc606ccdbf457c1b0a242e2dd383fc1200cdd1c290711aabea8d266f  vals-0.32.0.tar.gz
"
